﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HFController;
namespace HFWebApp.lawyeruser
{
    public partial class lawyerlist : BagePages
    {
        public string PageStr = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            //律师列表 5个
            if (!Page.IsPostBack)
            {
                int PageSize = 5;
                int PageNumber = 1;
                if (this.GetQuery("Page") != "")
                {
                    PageNumber = int.Parse(this.GetQuery("Page"));
                }
                int total = 0;
                string strWhere = "";

                #region 分类搜索
                string provinceid = this.GetQuery("provinceid");
                if (provinceid != "")
                {
                    if(provinceid != "0")
                        strWhere = "ProvinceID = " + provinceid.ToString();
                }
                string cityid = this.GetQuery("cityid");
                if (cityid != "")
                {
                    if (provinceid != "0")
                    {
                        if (strWhere == "")
                        {
                            strWhere = "CityID = " + cityid.ToString();
                        }
                        else
                        {
                            strWhere = strWhere + " and CityID = " + cityid.ToString();
                        }
                    }
                }
                string classid = this.GetAll("classid");
                if (classid != "")
                {
                    if (classid != "0")
                    {
                        if (strWhere == "")
                        {
                            strWhere = "areas like '%" + classid + "%'";
                        }
                        else
                        {
                            strWhere = strWhere + " and areas like '%" + classid + "%'";
                        }
                    }
                }
                string keyword = this.GetQuery("keyword");
                if (strWhere == "")
                {
                    strWhere = "RealName  like '%" + keyword + "%' ";
                }
                else
                {
                    strWhere = strWhere + " and RealName  like '%" + keyword + "%' ";
                }
                #endregion

                Repeater1.DataSource = LawyerController.getController().getLawyerList(PageSize, PageNumber, strWhere, out total);
                Repeater1.DataBind();
                PageStr = LLL.Pager.TrunPageHtmlCode_Web(PageSize, PageNumber, total, "");
            }
        }
    }
}